using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

namespace TripleMatch
{
    public class LevelObjLayerData
    {
        public ShapeType shapeType;

        public int count;
        public Vector2Int layerSize;

        public LevelObjData[][] layerLevelDatas;

        public void RandomLayerData(List<int> resultList)
        {
            resultList = Util.GetRangeList(resultList, resultList.Count);
            layerLevelDatas = new LevelObjData[layerSize.x][];
            for (int xIndex = 0; xIndex < layerSize.x; xIndex++)
            {
                layerLevelDatas[xIndex] = new LevelObjData[layerSize.y];
                for (int yIndex = 0; yIndex < layerSize.y; yIndex++)
                {
                    layerLevelDatas[xIndex][yIndex].objPostion = new Vector2(xIndex - layerSize.x / 2.0f + 0.5f, yIndex - layerSize.y / 2.0f + 0.5f);
                    layerLevelDatas[xIndex][yIndex].spriteType = resultList[xIndex * layerSize.y + yIndex];
                }
            }
        }
    }
}
